<template>
  <div class="app-container">
    <div class="filter-container">
      <el-form :inline="true" :model="formModel">
        <el-form-item class="no-warn-item" label="信息公开编号:" prop="environmentCertificateNo">
          <el-input
            v-model="formModel.environmentCertificateNo"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="车辆型号:" prop="clxh">
          <el-input
            v-model="formModel.clxh"
            class="filter-item "
            clearable
          />
        </el-form-item>
        <el-form-item class="no-warn-item" label="状态:" prop="status">
          <hey-select v-model="formModel.status" clcd="is_effective_cd" />
        </el-form-item>
        <el-row class="submit-area">
          <el-col :span="24">
            <el-button
              v-if="hasPermission('environmentCertificate_select')"
              type="primary"
              plain
              @click="queryList(false)"
            >查询
            </el-button>
            <el-button v-if="hasPermission('environmentCertificate_add')" type="primary" plain @click="handleAdd">新增
            </el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <hey-table ref="table" :table-data="tableData" :columns="columns">
      <template slot="tools">
        <el-table-column
          label="操作"
          width="120"
          fixed="right"
          header-align="center"
          align="center"
        >
          <template slot-scope="{row}">
            <span
              v-if="hasPermission('environmentCertificate_edit')"
              class="hey_tools_btn"
              @click="handleEdit(row)"
            >编辑</span>
            <span
              v-if="hasPermission('environmentCertificate_del')"
              class="hey_tools_btn"
              @click="handleDelete(row)"
            >删除</span>
          </template>
        </el-table-column>
      </template>
    </hey-table>
    <el-dialog
      v-if="dialogVisible"
      v-dialogDrag
      :close-on-click-modal="false"
      title="供应商信息"
      :visible.sync="dialogVisible"
      width="80%"
    >
      <ConsistencyCertificate-mnt :page-type="operateType" :edit-data="editData" @mntSuc="queryList" />
    </el-dialog>

  </div>
</template>

<script>

export default {
  name: 'ConsistencyCertificateList',
  components: {
    ConsistencyCertificateMnt: () => import('./environmentCertificate-mnt')
  },
  props: {},
  data() {
    return {
      dialogVisible: false,
      operateType: '',
      editData: {},
      tableData: [],
      // 查询条件
      formModel: {
        environmentCertificateNo: '',
        clxh: '',
        status: ''
      },
      columns: [
        { title: '信息公开编号', key: 'environmentCertificateNo' },
        { title: '车辆型号', key: 'clxh' },
        { title: '商标', key: 'sb' },
        { title: '汽车分类', key: 'qcfl' },
        { title: '排放阶段', key: 'pfjd' },
        { title: '车辆的识别方法和位置', key: 'cldsbffhwz' },
        { title: '车辆制造商名称', key: 'clzzsmc' },
        { title: '生产厂地址', key: 'sccdz' },
        { title: '发动机编号', key: 'fdjbh' },
        { title: '基准质量', key: 'jzzl' },
        { title: '发动机型号/生产企业', key: 'fdjxhscqy' },
        { title: '催化转化器型号/生产企业', key: 'chzhqxhscqy' },
        { title: '颗粒捕集器型号/生产企业', key: 'klbjqxhscqy' },
        { title: '炭罐型号/生产企业', key: 'tgxhscqy' },
        { title: '氧传感器型号/生产企业', key: 'ycgqxhscqy' },
        { title: '曲轴箱排放控制装置型号/生产企业', key: 'qzxpfkzzzxhscqy' },
        { title: 'EGR型号/生产企业', key: 'egrxhscqy' },
        { title: 'OBD系统供应商', key: 'obdxtgys' },
        { title: 'ECU型号/生产企业', key: 'ecuxhscqy' },
        { title: '变速器型式/档位数', key: 'bsqxsdws' },
        { title: '消声器型号/生产企业', key: 'xsqxhscqy' },
        { title: '增压器型号/生产企业', key: 'zyqxhscqy' },
        { title: '中冷器型式', key: 'zlqxs' },
        { title: '电动机型号/生产厂', key: 'ddjxhscc' },
        { title: '整车控制器型号/版本号/生产厂', key: 'zckzqxhbbhscc' },
        { title: '储能装置型号/生产厂', key: 'cnzzxhscc' },
        { title: '电池容量/续航里程', key: 'dcrlxhlc' },
        { title: '法人代表', key: 'frdb' },
        { title: '地址', key: 'dz' },
        { title: '联系电话', key: 'lxdh' },
        { title: '汽油车符合阶段', key: 'qycfhjd' },
        { title: 'PN满足', key: 'pnmz' },
        { title: 'RDE值', key: 'rdez' },
        { title: '环境保护耐久性里程', key: 'hjbhnjxlc' },
        { title: '测试实验', key: 'cssy' },

        { title: '状态', key: 'status', clcd: 'is_effective_cd' },
        { title: '创建时间', key: 'createTime' },
        { title: '创建人', key: 'createUsername' },
        { title: '最后修改时间', key: 'lastUpdateTime' },
        { title: '最后修改人', key: 'lastUpdateUsername' }
      ]
    }
  },
  computed: {},
  methods: {
    queryList() {
      this.$refs.table.query('/environmentCertificate/page', this.formModel, '', false)
    },
    handleAdd() {
      this.operateType = 'add'
      this.dialogVisible = true
    },
    handleEdit(row) {
      this.dialogVisible = true
      this.operateType = 'edit'
      this.editData = row || {}
    },
    handleDelete(row) {
      this.$sure('确认删除？', _ => {
        this.post('/environmentCertificate/delete', {
          environmentCertificateId: row.environmentCertificateId
        }).then(_ => {
          this.$info('删除成功', this.queryList)
        })
      })
    }
  }
}
</script>
